import java.util.Scanner;


import java.util.ArrayList;
class Book {
    String name;
    int price;
    String author;
    int edition;

    public Book(String name, int price, String author, int edition) {
        this.name = name;
        this.price = price;
        this.author = author;
        this.edition = edition;
    }

    public boolean equals(Book book) {
        if(this.name.equals(book.name) && this.author.equals(book.author) && this.edition == book.edition) {
            return true;
        }
        return false;
    }
}

class BookList {
    ArrayList<Book> list = new ArrayList();

    public void addBook(Book book) {
        list.add(book);
    }

    public void searchBook(Book book) {
        int index = 0;
        for(Book b : list) {
            if(b.equals(book)) {
                System.out.println("found: " +  index);
                return;
            }
            index++;
        }

        System.out.println("not found");
    }

}

public class Main3{

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        BookList bl = new BookList();
        int n = s.nextInt();
        for (int i=0; i<n;i++) {
            bl.addBook(new Book(s.next(),
                    s.nextInt(),
                    s.next(),
                    s.nextInt()));
        }
        bl.searchBook(new Book(s.next(),
                0,
                s.next(),s.nextInt()));
    }
}
